HEADLINE MAKER
長いPageでも安心
利用Image
https://gyazo.com/3236e5042e32e31a9265e8764a903800
code:script.js
scrapbox.PageMenu.addMenu({
title: 'CREATE HEADLINES w/URL',
onClick: () => {
var headlines = [];
for (let line of scrapbox.Page.lines) {
if (!line.section.start) continue
var title = line.text
var url = location.href
url = url.replace(/#.+$/g,"");
url = url + "#"+ line.id;
headlines.push(headline)
}
if(navigator.clipboard){
navigator.clipboard.
writeText(headlines.join('\n'));
}
}
})
code:script_disable.js
scrapbox.PageMenu.addMenu({
title: 'CREATE HEADLINES w/URL',
onClick: () => {
var headlines = [];
for (let line of scrapbox.Page.lines) {
if (!line.section.start) continue
var title = line.text
title = title.replace(/^\[\_\*+ (.+)\]$/,"$1"); var firstIcon = title.match(/^\[([^\\]+)\.icon\]/); title = title.replace(/^\[([^\\]+)\.icon\]/,""); var lastIcon = title.match(/\[([^\\]+)\.icon\]$/,"$1"); title = title.replace(/\[([^\\]+)\.icon\]$/,""); var headline = "";
if ( firstIcon !=null){
}
title = title.replace( /\[([^\\]+)\.icon\]/g,"($1)"); title = title.replace( /\[([^\\]+)\]/g,"$1"); if(title == ""){
title = "link"
}
var url = location.href
url = url.replace(/#.+$/g,"");
url = url + "#"+ line.id;
headline += "+ title + " " + url + ""
if ( lastIcon !=null){
}
headlines.push(headline);
}
console.log(headlines);
if(navigator.clipboard){
navigator.clipboard.
writeText(headlines.join('\n'));
}
}
})